﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace FierceWar
{
	public class Utilities
	{
		public static Vector3 Multiply(Vector3 v, Matrix m)
		{
			return
				new Vector3(v.X * m.M11 + v.Y * m.M21 + v.Z * m.M31 + m.M41,
							v.X * m.M12 + v.Y * m.M22 + v.Z * m.M32 + m.M42,
							v.X * m.M13 + v.Y * m.M23 + v.Z * m.M33 + m.M43);
		}

		public static Matrix3 Abs(Matrix3 m3)
		{
			Matrix3 absMatrix = new Matrix3(0);

			for (int r = 0; r < 3; r++)
			{
				for (int c = 0; c < 3; c++)
				{
					absMatrix[r, c] = Math.Abs(m3[r, c]);
				}
			}

			return absMatrix;
		}
	}
}
